﻿// Decompiled with JetBrains decompiler
// Type: BUTR.DependencyInjection.WithHistoryGenericServiceContainer
// Assembly: MCMv5, Version=5.10.2.0, Culture=neutral, PublicKeyToken=null
// MVID: 7AB326B9-B2B4-41C2-9177-68E944071101
// Assembly location: D:\steam\steamapps\workshop\content\261550\2859238197\bin\Win64_Shipping_Client\MCMv5.dll

using System;
using System.Collections.Generic;

#nullable enable
namespace BUTR.DependencyInjection
{
  public class WithHistoryGenericServiceContainer : IGenericServiceContainer
  {
    private readonly IGenericServiceContainer _serviceContainer;

    public List<Action<IGenericServiceContainer>> History { get; } = new List<Action<IGenericServiceContainer>>();

    public WithHistoryGenericServiceContainer(IGenericServiceContainer serviceContainer)
    {
      this._serviceContainer = serviceContainer;
    }

    public IGenericServiceContainer RegisterSingleton<TService>() where TService : class
    {
      this.History.Add((Action<IGenericServiceContainer>) (serviceContainer => serviceContainer.RegisterSingleton<TService>()));
      return this._serviceContainer.RegisterSingleton<TService>();
    }

    public IGenericServiceContainer RegisterSingleton<TService>(
      Func<IGenericServiceFactory, TService> factory)
      where TService : class
    {
      this.History.Add((Action<IGenericServiceContainer>) (serviceContainer => serviceContainer.RegisterSingleton<TService>(factory)));
      return this._serviceContainer.RegisterSingleton<TService>(factory);
    }

    public IGenericServiceContainer RegisterSingleton<TService, TImplementation>()
      where TService : class
      where TImplementation : class, TService
    {
      this.History.Add((Action<IGenericServiceContainer>) (serviceContainer => serviceContainer.RegisterSingleton<TService, TImplementation>()));
      return this._serviceContainer.RegisterSingleton<TService, TImplementation>();
    }

    public IGenericServiceContainer RegisterSingleton<TService, TImplementation>(
      Func<IGenericServiceFactory, TImplementation> factory)
      where TService : class
      where TImplementation : class, TService
    {
      this.History.Add((Action<IGenericServiceContainer>) (serviceContainer => serviceContainer.RegisterSingleton<TService, TImplementation>(factory)));
      return this._serviceContainer.RegisterSingleton<TService, TImplementation>(factory);
    }

    public IGenericServiceContainer RegisterSingleton(Type serviceType, Type implementationType)
    {
      this.History.Add((Action<IGenericServiceContainer>) (serviceContainer => serviceContainer.RegisterSingleton(serviceType, implementationType)));
      return this._serviceContainer.RegisterSingleton(serviceType, implementationType);
    }

    public IGenericServiceContainer RegisterSingleton(Type serviceType, Func<object> factory)
    {
      this.History.Add((Action<IGenericServiceContainer>) (serviceContainer => serviceContainer.RegisterSingleton(serviceType, factory)));
      return this._serviceContainer.RegisterSingleton(serviceType, factory);
    }

    public IGenericServiceContainer RegisterScoped<TService>() where TService : class
    {
      this.History.Add((Action<IGenericServiceContainer>) (serviceContainer => serviceContainer.RegisterScoped<TService>()));
      return this._serviceContainer.RegisterScoped<TService>();
    }

    public IGenericServiceContainer RegisterScoped<TService>(
      Func<IGenericServiceFactory, TService> factory)
      where TService : class
    {
      this.History.Add((Action<IGenericServiceContainer>) (serviceContainer => serviceContainer.RegisterScoped<TService>(factory)));
      return this._serviceContainer.RegisterScoped<TService>(factory);
    }

    public IGenericServiceContainer RegisterScoped<TService, TImplementation>()
      where TService : class
      where TImplementation : class, TService
    {
      this.History.Add((Action<IGenericServiceContainer>) (serviceContainer => serviceContainer.RegisterScoped<TService, TImplementation>()));
      return this._serviceContainer.RegisterScoped<TService, TImplementation>();
    }

    public IGenericServiceContainer RegisterScoped<TService, TImplementation>(
      Func<IGenericServiceFactory, TImplementation> factory)
      where TService : class
      where TImplementation : class, TService
    {
      this.History.Add((Action<IGenericServiceContainer>) (serviceContainer => serviceContainer.RegisterScoped<TService, TImplementation>(factory)));
      return this._serviceContainer.RegisterScoped<TService, TImplementation>(factory);
    }

    public IGenericServiceContainer RegisterScoped(Type serviceType, Type implementationType)
    {
      this.History.Add((Action<IGenericServiceContainer>) (serviceContainer => serviceContainer.RegisterScoped(serviceType, implementationType)));
      return this._serviceContainer.RegisterScoped(serviceType, implementationType);
    }

    public IGenericServiceContainer RegisterScoped(Type serviceType, Func<object> factory)
    {
      this.History.Add((Action<IGenericServiceContainer>) (serviceContainer => serviceContainer.RegisterScoped(serviceType, factory)));
      return this._serviceContainer.RegisterScoped(serviceType, factory);
    }

    public IGenericServiceContainer RegisterTransient<TService>() where TService : class
    {
      this.History.Add((Action<IGenericServiceContainer>) (serviceContainer => serviceContainer.RegisterTransient<TService>()));
      return this._serviceContainer.RegisterTransient<TService>();
    }

    public IGenericServiceContainer RegisterTransient<TService>(
      Func<IGenericServiceFactory, TService> factory)
      where TService : class
    {
      this.History.Add((Action<IGenericServiceContainer>) (serviceContainer => serviceContainer.RegisterTransient<TService>(factory)));
      return this._serviceContainer.RegisterTransient<TService>(factory);
    }

    public IGenericServiceContainer RegisterTransient<TService, TImplementation>()
      where TService : class
      where TImplementation : class, TService
    {
      this.History.Add((Action<IGenericServiceContainer>) (serviceContainer => serviceContainer.RegisterTransient<TService, TImplementation>()));
      return this._serviceContainer.RegisterTransient<TService, TImplementation>();
    }

    public IGenericServiceContainer RegisterTransient<TService, TImplementation>(
      Func<IGenericServiceFactory, TImplementation> factory)
      where TService : class
      where TImplementation : class, TService
    {
      this.History.Add((Action<IGenericServiceContainer>) (serviceContainer => serviceContainer.RegisterTransient<TService, TImplementation>(factory)));
      return this._serviceContainer.RegisterTransient<TService, TImplementation>(factory);
    }

    public IGenericServiceContainer RegisterTransient(Type serviceType, Type implementationType)
    {
      this.History.Add((Action<IGenericServiceContainer>) (serviceContainer => serviceContainer.RegisterTransient(serviceType, implementationType)));
      return this._serviceContainer.RegisterTransient(serviceType, implementationType);
    }

    public IGenericServiceContainer RegisterTransient(Type serviceType, Func<object> factory)
    {
      this.History.Add((Action<IGenericServiceContainer>) (serviceContainer => serviceContainer.RegisterTransient(serviceType, factory)));
      return this._serviceContainer.RegisterTransient(serviceType, factory);
    }

    public IGenericServiceProvider Build()
    {
      this.History.Clear();
      return this._serviceContainer.Build();
    }
  }
}
